<?php
Loader::loadClass('AntiSpam', "modules/icarrent/pnincludes");
class PNUserTopics extends PNObjectEx {
  function PNUserTopics($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'icarrent_topics';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_objJoin[]     = array ( 'join_table'  =>  'icarrent_category',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('category_name'),
                            'compare_field_table' =>  'category_id',
                            'compare_field_join'  =>  'id');

    $this->_objJoin[]     = array ( 'join_table'  =>  'icarrent_subcategory',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('subcategory_name'),
                            'compare_field_table' =>  'subcategory_id',
                            'compare_field_join'  =>  'id');
    $this->_objJoin[]     = array ( 'join_table'  =>  'icarrent_brand',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('brand_name'),
                            'compare_field_table' =>  'brand_id',
                            'compare_field_join'  =>  'id');
    $this->_objJoin[]     = array ( 'join_table'  =>  'icarrent_model',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('model_name'),
                            'compare_field_table' =>  'model_id',
                            'compare_field_join'  =>  'id');
    $this->_objJoin[]     = array ( 'join_table'  =>  'icarrent_shop',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('shop_name'),
                            'compare_field_table' =>  'shop_id',
                            'compare_field_join'  =>  'id');
    

    //permission for post new | edit topic
    $func = FormUtil::getPassedValue ('func', false);
    $ctrl = FormUtil::getPassedValue ('ctrl', false);
    $this->_objPermission = array('component' => "icarrent:$func:$ctrl",
                                  'instance'  => '.*',
                                  'level'     => USER_EDIT_LEVEL);
    $this->_init($init, $where);
  }
}